<!DOCTYPE html>
<html>
<head>
    <th:block th:include="include :: header('企业端')"/>
    <link href="/unit/resource/css/style.css" rel="stylesheet" />
    <script src="/common.js"></script>
    <script src="/unit/resource/js/script.js"></script>
</head>
<body>
<div class="page">
    <th:block th:include="include :: top"/>
    <div class="center">
        <div class="page-content page-wrap">
            <th:block th:include="include :: left"/>
            <div class="page-wrap-container">
                <div class="page-information-notice">
                    <h3 style="margin:10px 0">续互通知</h3>
                    <table class="page-table page-table-list" style="margin-bottom:40px">
                        <tr>
                            <th>活动名称</th>
                            <th>标准人数</th>
                            <th style="width:280px;">过期时间</th>
                            <th></th>
                        </tr>
                        <c:if test="${empty renewalPolicys}">
                            <tr>
                                <td colspan="5" style="padding:20px;">暂无待续保活动</td>
                            </tr>
                        </c:if>
                        <c:if test="${not empty renewalPolicys}">
                            <c:forEach items="${renewalPolicys}" var="renewalPolicy">
                                <tr>
                                    <td>${renewalPolicy.insurancename}</td>
                                    <td>
                                        ${renewalPolicy.totalperson}人
                                    </td>
                                    <td>
                                        <span style="color:red">${renewalPolicy.endDate}</span>
                                    </td>
                                    <td>
                                        <%-- <a class="layui-btn apply-btn-renewal"
                                                data-id="/hzpolicy/hzPolicyFront/policySituation"
                                                onclick="renewalPolicyApply(${renewalPolicy.id})">续互</a> --%>
                                        <a class="layui-btn apply-btn-renewal"
                                           href="/hzpolicy/hzPolicyFront/policySituation">前往查看</a>
                                    </td>
                                </tr>
                            </c:forEach>
                        </c:if>
                    </table>

                    <h3 style="margin:10px 0">最新公告</h3>
                    <c:forEach items="${hzHelpNotices.list}" var="notice">
                        <a class="helpNoticeDetail"
                           href="/hzhelp/notice/hzHelpNotice/detail?id=${notice.id}">${notice.title}</a>
                    </c:forEach>

                </div>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer"/>
</div>

<script type="text/javascript">
    /* 续互 */
    function renewalPolicyApply(renewalId) {
        alert(renewalId)
        layer.confirm('确实要发起续互申请吗？', {
            btn: ['发起', '取消']
        }, function () {
            $.soon.ajax({
                url: "/hzpolicy/hzPolicyFront/renewalPolicyApply?id=" + renewalId,
                method: 'Post',
                dataType: "json",
                success: function (data) {
                    if (data.success) {
                        layer.msg("处理成功");
                        setTimeout(function () {
                            window.location.href = "/hzpolicy/hzPolicyFront/launchPolicyApply?id=" + data.body.policy.id;
                        }, 1000);
                    } else {
                        layer.msg(data.msg);
                    }
                }
            });
        });
    }
</script>
</body>
</html>
